﻿///////////////////////////////////////////////////////////////
// This is generated code. 
//////////////////////////////////////////////////////////////
// Code is generated using LLBLGen Pro version: 2.6
// Code is generated on: 2011年7月5日 11:37:43
// Code is generated using templates: SD.TemplateBindings.SharedTemplates.NET20
// Templates vendor: Solutions Design.
// Templates version: 
//////////////////////////////////////////////////////////////
using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Collections;
#if !CF
using System.Runtime.Serialization;
#endif
using System.Data;
using System.Xml.Serialization;
using CARMSData;
using CARMSData.FactoryClasses;
using CARMSData.DaoClasses;
using CARMSData.RelationClasses;
using CARMSData.HelperClasses;
using CARMSData.CollectionClasses;

using SD.LLBLGen.Pro.ORMSupportClasses;

namespace CARMSData.EntityClasses
{
	
	// __LLBLGENPRO_USER_CODE_REGION_START AdditionalNamespaces
	// __LLBLGENPRO_USER_CODE_REGION_END

	/// <summary>
	/// Entity class which represents the entity 'Action'. <br/><br/>
	/// 
	/// </summary>
	[Serializable]
	public partial class ActionEntity : CommonEntityBase, ISerializable
		// __LLBLGENPRO_USER_CODE_REGION_START AdditionalInterfaces
		// __LLBLGENPRO_USER_CODE_REGION_END	
	{
		#region Class Member Declarations
		private CARMSData.CollectionClasses.ActionGridColumnCollection	_actionGridColumn;
		private bool	_alwaysFetchActionGridColumn, _alreadyFetchedActionGridColumn;
		private CARMSData.CollectionClasses.RoleActionCollection	_roleAction;
		private bool	_alwaysFetchRoleAction, _alreadyFetchedRoleAction;
		private CARMSData.CollectionClasses.TemplateCollection	_template;
		private bool	_alwaysFetchTemplate, _alreadyFetchedTemplate;
		private CARMSData.CollectionClasses.UserActionCollection	_userAction;
		private bool	_alwaysFetchUserAction, _alreadyFetchedUserAction;
		private CARMSData.CollectionClasses.RoleCollection _roleCollectionViaRoleAction;
		private bool	_alwaysFetchRoleCollectionViaRoleAction, _alreadyFetchedRoleCollectionViaRoleAction;
		private CARMSData.CollectionClasses.UserCollection _userCollectionViaUserAction;
		private bool	_alwaysFetchUserCollectionViaUserAction, _alreadyFetchedUserCollectionViaUserAction;


		
		// __LLBLGENPRO_USER_CODE_REGION_START PrivateMembers
		// __LLBLGENPRO_USER_CODE_REGION_END
		#endregion

		#region Statics
		private static Dictionary<string, string>	_customProperties;
		private static Dictionary<string, Dictionary<string, string>>	_fieldsCustomProperties;

		/// <summary>All names of fields mapped onto a relation. Usable for in-memory filtering</summary>
		public static partial class MemberNames
		{

			/// <summary>Member name ActionGridColumn</summary>
			public static readonly string ActionGridColumn = "ActionGridColumn";
			/// <summary>Member name RoleAction</summary>
			public static readonly string RoleAction = "RoleAction";
			/// <summary>Member name Template</summary>
			public static readonly string Template = "Template";
			/// <summary>Member name UserAction</summary>
			public static readonly string UserAction = "UserAction";
			/// <summary>Member name RoleCollectionViaRoleAction</summary>
			public static readonly string RoleCollectionViaRoleAction = "RoleCollectionViaRoleAction";
			/// <summary>Member name UserCollectionViaUserAction</summary>
			public static readonly string UserCollectionViaUserAction = "UserCollectionViaUserAction";

		}
		#endregion
		
		/// <summary>Static CTor for setting up custom property hashtables. Is executed before the first instance of this entity class or derived classes is constructed. </summary>
		static ActionEntity()
		{
			SetupCustomPropertyHashtables();
		}

		/// <summary>CTor</summary>
		public ActionEntity()
		{
			InitClassEmpty(null);
		}


		/// <summary>CTor</summary>
		/// <param name="actionId">PK value for Action which data should be fetched into this Action object</param>
		public ActionEntity(System.String actionId)
		{
			InitClassFetch(actionId, null, null);
		}

		/// <summary>CTor</summary>
		/// <param name="actionId">PK value for Action which data should be fetched into this Action object</param>
		/// <param name="prefetchPathToUse">the PrefetchPath which defines the graph of objects to fetch as well</param>
		public ActionEntity(System.String actionId, IPrefetchPath prefetchPathToUse)
		{
			InitClassFetch(actionId, null, prefetchPathToUse);
		}

		/// <summary>CTor</summary>
		/// <param name="actionId">PK value for Action which data should be fetched into this Action object</param>
		/// <param name="validator">The custom validator object for this ActionEntity</param>
		public ActionEntity(System.String actionId, IValidator validator)
		{
			InitClassFetch(actionId, validator, null);
		}


		/// <summary>Private CTor for deserialization</summary>
		/// <param name="info"></param>
		/// <param name="context"></param>
		protected ActionEntity(SerializationInfo info, StreamingContext context) : base(info, context)
		{
			_actionGridColumn = (CARMSData.CollectionClasses.ActionGridColumnCollection)info.GetValue("_actionGridColumn", typeof(CARMSData.CollectionClasses.ActionGridColumnCollection));
			_alwaysFetchActionGridColumn = info.GetBoolean("_alwaysFetchActionGridColumn");
			_alreadyFetchedActionGridColumn = info.GetBoolean("_alreadyFetchedActionGridColumn");
			_roleAction = (CARMSData.CollectionClasses.RoleActionCollection)info.GetValue("_roleAction", typeof(CARMSData.CollectionClasses.RoleActionCollection));
			_alwaysFetchRoleAction = info.GetBoolean("_alwaysFetchRoleAction");
			_alreadyFetchedRoleAction = info.GetBoolean("_alreadyFetchedRoleAction");
			_template = (CARMSData.CollectionClasses.TemplateCollection)info.GetValue("_template", typeof(CARMSData.CollectionClasses.TemplateCollection));
			_alwaysFetchTemplate = info.GetBoolean("_alwaysFetchTemplate");
			_alreadyFetchedTemplate = info.GetBoolean("_alreadyFetchedTemplate");
			_userAction = (CARMSData.CollectionClasses.UserActionCollection)info.GetValue("_userAction", typeof(CARMSData.CollectionClasses.UserActionCollection));
			_alwaysFetchUserAction = info.GetBoolean("_alwaysFetchUserAction");
			_alreadyFetchedUserAction = info.GetBoolean("_alreadyFetchedUserAction");
			_roleCollectionViaRoleAction = (CARMSData.CollectionClasses.RoleCollection)info.GetValue("_roleCollectionViaRoleAction", typeof(CARMSData.CollectionClasses.RoleCollection));
			_alwaysFetchRoleCollectionViaRoleAction = info.GetBoolean("_alwaysFetchRoleCollectionViaRoleAction");
			_alreadyFetchedRoleCollectionViaRoleAction = info.GetBoolean("_alreadyFetchedRoleCollectionViaRoleAction");
			_userCollectionViaUserAction = (CARMSData.CollectionClasses.UserCollection)info.GetValue("_userCollectionViaUserAction", typeof(CARMSData.CollectionClasses.UserCollection));
			_alwaysFetchUserCollectionViaUserAction = info.GetBoolean("_alwaysFetchUserCollectionViaUserAction");
			_alreadyFetchedUserCollectionViaUserAction = info.GetBoolean("_alreadyFetchedUserCollectionViaUserAction");


			base.FixupDeserialization(FieldInfoProviderSingleton.GetInstance(), PersistenceInfoProviderSingleton.GetInstance());
			
			// __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor
			// __LLBLGENPRO_USER_CODE_REGION_END
		}

		
		/// <summary>Performs the desync setup when an FK field has been changed. The entity referenced based on the FK field will be dereferenced and sync info will be removed.</summary>
		/// <param name="fieldIndex">The fieldindex.</param>
		protected override void PerformDesyncSetupFKFieldChange(int fieldIndex)
		{
			switch((ActionFieldIndex)fieldIndex)
			{
				default:
					base.PerformDesyncSetupFKFieldChange(fieldIndex);
					break;
			}
		}
		
		/// <summary>Gets the inheritance info provider instance of the project this entity instance is located in. </summary>
		/// <returns>ready to use inheritance info provider instance.</returns>
		protected override IInheritanceInfoProvider GetInheritanceInfoProvider()
		{
			return InheritanceInfoProviderSingleton.GetInstance();
		}
		
		/// <summary> Will perform post-ReadXml actions</summary>
		protected override void PostReadXmlFixups()
		{
			_alreadyFetchedActionGridColumn = (_actionGridColumn.Count > 0);
			_alreadyFetchedRoleAction = (_roleAction.Count > 0);
			_alreadyFetchedTemplate = (_template.Count > 0);
			_alreadyFetchedUserAction = (_userAction.Count > 0);
			_alreadyFetchedRoleCollectionViaRoleAction = (_roleCollectionViaRoleAction.Count > 0);
			_alreadyFetchedUserCollectionViaUserAction = (_userCollectionViaUserAction.Count > 0);


		}
				
		/// <summary>Gets the relation objects which represent the relation the fieldName specified is mapped on. </summary>
		/// <param name="fieldName">Name of the field mapped onto the relation of which the relation objects have to be obtained.</param>
		/// <returns>RelationCollection with relation object(s) which represent the relation the field is maped on</returns>
		public override RelationCollection GetRelationsForFieldOfType(string fieldName)
		{
			return ActionEntity.GetRelationsForField(fieldName);
		}

		/// <summary>Gets the relation objects which represent the relation the fieldName specified is mapped on. </summary>
		/// <param name="fieldName">Name of the field mapped onto the relation of which the relation objects have to be obtained.</param>
		/// <returns>RelationCollection with relation object(s) which represent the relation the field is maped on</returns>
		public static RelationCollection GetRelationsForField(string fieldName)
		{
			RelationCollection toReturn = new RelationCollection();
			switch(fieldName)
			{

				case "ActionGridColumn":
					toReturn.Add(ActionEntity.Relations.ActionGridColumnEntityUsingActionId);
					break;
				case "RoleAction":
					toReturn.Add(ActionEntity.Relations.RoleActionEntityUsingActionId);
					break;
				case "Template":
					toReturn.Add(ActionEntity.Relations.TemplateEntityUsingShowActionId);
					break;
				case "UserAction":
					toReturn.Add(ActionEntity.Relations.UserActionEntityUsingActionId);
					break;
				case "RoleCollectionViaRoleAction":
					toReturn.Add(ActionEntity.Relations.RoleActionEntityUsingActionId, "ActionEntity__", "RoleAction_", JoinHint.None);
					toReturn.Add(RoleActionEntity.Relations.RoleEntityUsingRoleId, "RoleAction_", string.Empty, JoinHint.None);
					break;
				case "UserCollectionViaUserAction":
					toReturn.Add(ActionEntity.Relations.UserActionEntityUsingActionId, "ActionEntity__", "UserAction_", JoinHint.None);
					toReturn.Add(UserActionEntity.Relations.UserEntityUsingUserId, "UserAction_", string.Empty, JoinHint.None);
					break;

				default:

					break;				
			}
			return toReturn;
		}



		/// <summary> ISerializable member. Does custom serialization so event handlers do not get serialized.
		/// Serializes members of this entity class and uses the base class' implementation to serialize the rest.</summary>
		/// <param name="info"></param>
		/// <param name="context"></param>
		[EditorBrowsable(EditorBrowsableState.Never)]
		public override void GetObjectData(SerializationInfo info, StreamingContext context)
		{
			info.AddValue("_actionGridColumn", (!this.MarkedForDeletion?_actionGridColumn:null));
			info.AddValue("_alwaysFetchActionGridColumn", _alwaysFetchActionGridColumn);
			info.AddValue("_alreadyFetchedActionGridColumn", _alreadyFetchedActionGridColumn);
			info.AddValue("_roleAction", (!this.MarkedForDeletion?_roleAction:null));
			info.AddValue("_alwaysFetchRoleAction", _alwaysFetchRoleAction);
			info.AddValue("_alreadyFetchedRoleAction", _alreadyFetchedRoleAction);
			info.AddValue("_template", (!this.MarkedForDeletion?_template:null));
			info.AddValue("_alwaysFetchTemplate", _alwaysFetchTemplate);
			info.AddValue("_alreadyFetchedTemplate", _alreadyFetchedTemplate);
			info.AddValue("_userAction", (!this.MarkedForDeletion?_userAction:null));
			info.AddValue("_alwaysFetchUserAction", _alwaysFetchUserAction);
			info.AddValue("_alreadyFetchedUserAction", _alreadyFetchedUserAction);
			info.AddValue("_roleCollectionViaRoleAction", (!this.MarkedForDeletion?_roleCollectionViaRoleAction:null));
			info.AddValue("_alwaysFetchRoleCollectionViaRoleAction", _alwaysFetchRoleCollectionViaRoleAction);
			info.AddValue("_alreadyFetchedRoleCollectionViaRoleAction", _alreadyFetchedRoleCollectionViaRoleAction);
			info.AddValue("_userCollectionViaUserAction", (!this.MarkedForDeletion?_userCollectionViaUserAction:null));
			info.AddValue("_alwaysFetchUserCollectionViaUserAction", _alwaysFetchUserCollectionViaUserAction);
			info.AddValue("_alreadyFetchedUserCollectionViaUserAction", _alreadyFetchedUserCollectionViaUserAction);


			
			// __LLBLGENPRO_USER_CODE_REGION_START GetObjectInfo
			// __LLBLGENPRO_USER_CODE_REGION_END
			base.GetObjectData(info, context);
		}
		
		/// <summary> Sets the related entity property to the entity specified. If the property is a collection, it will add the entity specified to that collection.</summary>
		/// <param name="propertyName">Name of the property.</param>
		/// <param name="entity">Entity to set as an related entity</param>
		/// <remarks>Used by prefetch path logic.</remarks>
		[EditorBrowsable(EditorBrowsableState.Never)]
		public override void SetRelatedEntityProperty(string propertyName, IEntity entity)
		{
			switch(propertyName)
			{

				case "ActionGridColumn":
					_alreadyFetchedActionGridColumn = true;
					if(entity!=null)
					{
						this.ActionGridColumn.Add((ActionGridColumnEntity)entity);
					}
					break;
				case "RoleAction":
					_alreadyFetchedRoleAction = true;
					if(entity!=null)
					{
						this.RoleAction.Add((RoleActionEntity)entity);
					}
					break;
				case "Template":
					_alreadyFetchedTemplate = true;
					if(entity!=null)
					{
						this.Template.Add((TemplateEntity)entity);
					}
					break;
				case "UserAction":
					_alreadyFetchedUserAction = true;
					if(entity!=null)
					{
						this.UserAction.Add((UserActionEntity)entity);
					}
					break;
				case "RoleCollectionViaRoleAction":
					_alreadyFetchedRoleCollectionViaRoleAction = true;
					if(entity!=null)
					{
						this.RoleCollectionViaRoleAction.Add((RoleEntity)entity);
					}
					break;
				case "UserCollectionViaUserAction":
					_alreadyFetchedUserCollectionViaUserAction = true;
					if(entity!=null)
					{
						this.UserCollectionViaUserAction.Add((UserEntity)entity);
					}
					break;

				default:

					break;
			}
		}

		/// <summary> Sets the internal parameter related to the fieldname passed to the instance relatedEntity. </summary>
		/// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
		/// <param name="fieldName">Name of field mapped onto the relation which resolves in the instance relatedEntity</param>
		[EditorBrowsable(EditorBrowsableState.Never)]
		public override void SetRelatedEntity(IEntity relatedEntity, string fieldName)
		{
			switch(fieldName)
			{

				case "ActionGridColumn":
					_actionGridColumn.Add((ActionGridColumnEntity)relatedEntity);
					break;
				case "RoleAction":
					_roleAction.Add((RoleActionEntity)relatedEntity);
					break;
				case "Template":
					_template.Add((TemplateEntity)relatedEntity);
					break;
				case "UserAction":
					_userAction.Add((UserActionEntity)relatedEntity);
					break;

				default:

					break;
			}
		}
		
		/// <summary> Unsets the internal parameter related to the fieldname passed to the instance relatedEntity. Reverses the actions taken by SetRelatedEntity() </summary>
		/// <param name="relatedEntity">Instance to unset as the related entity of type entityType</param>
		/// <param name="fieldName">Name of field mapped onto the relation which resolves in the instance relatedEntity</param>
		/// <param name="signalRelatedEntityManyToOne">if set to true it will notify the manytoone side, if applicable.</param>
		[EditorBrowsable(EditorBrowsableState.Never)]
		public override void UnsetRelatedEntity(IEntity relatedEntity, string fieldName, bool signalRelatedEntityManyToOne)
		{
			switch(fieldName)
			{

				case "ActionGridColumn":
					base.PerformRelatedEntityRemoval(_actionGridColumn, relatedEntity, signalRelatedEntityManyToOne);
					break;
				case "RoleAction":
					base.PerformRelatedEntityRemoval(_roleAction, relatedEntity, signalRelatedEntityManyToOne);
					break;
				case "Template":
					base.PerformRelatedEntityRemoval(_template, relatedEntity, signalRelatedEntityManyToOne);
					break;
				case "UserAction":
					base.PerformRelatedEntityRemoval(_userAction, relatedEntity, signalRelatedEntityManyToOne);
					break;

				default:

					break;
			}
		}

		/// <summary> Gets a collection of related entities referenced by this entity which depend on this entity (this entity is the PK side of their FK fields). These
		/// entities will have to be persisted after this entity during a recursive save.</summary>
		/// <returns>Collection with 0 or more IEntity objects, referenced by this entity</returns>
		public override List<IEntity> GetDependingRelatedEntities()
		{
			List<IEntity> toReturn = new List<IEntity>();


			return toReturn;
		}
		
		/// <summary> Gets a collection of related entities referenced by this entity which this entity depends on (this entity is the FK side of their PK fields). These
		/// entities will have to be persisted before this entity during a recursive save.</summary>
		/// <returns>Collection with 0 or more IEntity objects, referenced by this entity</returns>
		public override List<IEntity> GetDependentRelatedEntities()
		{
			List<IEntity> toReturn = new List<IEntity>();



			return toReturn;
		}
		
		/// <summary> Gets a List of all entity collections stored as member variables in this entity. The contents of the ArrayList is
		/// used by the DataAccessAdapter to perform recursive saves. Only 1:n related collections are returned.</summary>
		/// <returns>Collection with 0 or more IEntityCollection objects, referenced by this entity</returns>
		public override List<IEntityCollection> GetMemberEntityCollections()
		{
			List<IEntityCollection> toReturn = new List<IEntityCollection>();
			toReturn.Add(_actionGridColumn);
			toReturn.Add(_roleAction);
			toReturn.Add(_template);
			toReturn.Add(_userAction);

			return toReturn;
		}

		

		

		/// <summary> Fetches the contents of this entity from the persistent storage using the primary key.</summary>
		/// <param name="actionId">PK value for Action which data should be fetched into this Action object</param>
		/// <returns>True if succeeded, false otherwise.</returns>
		public bool FetchUsingPK(System.String actionId)
		{
			return FetchUsingPK(actionId, null, null, null);
		}

		/// <summary> Fetches the contents of this entity from the persistent storage using the primary key.</summary>
		/// <param name="actionId">PK value for Action which data should be fetched into this Action object</param>
		/// <param name="prefetchPathToUse">the PrefetchPath which defines the graph of objects to fetch as well</param>
		/// <returns>True if succeeded, false otherwise.</returns>
		public bool FetchUsingPK(System.String actionId, IPrefetchPath prefetchPathToUse)
		{
			return FetchUsingPK(actionId, prefetchPathToUse, null, null);
		}

		/// <summary> Fetches the contents of this entity from the persistent storage using the primary key.</summary>
		/// <param name="actionId">PK value for Action which data should be fetched into this Action object</param>
		/// <param name="prefetchPathToUse">the PrefetchPath which defines the graph of objects to fetch as well</param>
		/// <param name="contextToUse">The context to add the entity to if the fetch was succesful. </param>
		/// <returns>True if succeeded, false otherwise.</returns>
		public bool FetchUsingPK(System.String actionId, IPrefetchPath prefetchPathToUse, Context contextToUse)
		{
			return Fetch(actionId, prefetchPathToUse, contextToUse, null);
		}

		/// <summary> Fetches the contents of this entity from the persistent storage using the primary key.</summary>
		/// <param name="actionId">PK value for Action which data should be fetched into this Action object</param>
		/// <param name="prefetchPathToUse">the PrefetchPath which defines the graph of objects to fetch as well</param>
		/// <param name="contextToUse">The context to add the entity to if the fetch was succesful. </param>
		/// <param name="excludedIncludedFields">The list of IEntityField objects which have to be excluded or included for the fetch. 
		/// If null or empty, all fields are fetched (default). If an instance of ExcludeIncludeFieldsList is passed in and its ExcludeContainedFields property
		/// is set to false, the fields contained in excludedIncludedFields are kept in the query, the rest of the fields in the query are excluded.</param>
		/// <returns>True if succeeded, false otherwise.</returns>
		public bool FetchUsingPK(System.String actionId, IPrefetchPath prefetchPathToUse, Context contextToUse, ExcludeIncludeFieldsList excludedIncludedFields)
		{
			return Fetch(actionId, prefetchPathToUse, contextToUse, excludedIncludedFields);
		}

		/// <summary> Refetches the Entity from the persistent storage. Refetch is used to re-load an Entity which is marked "Out-of-sync", due to a save action. 
		/// Refetching an empty Entity has no effect. </summary>
		/// <returns>true if Refetch succeeded, false otherwise</returns>
		public override bool Refetch()
		{
			return Fetch(this.ActionId, null, null, null);
		}

		/// <summary> Returns true if the original value for the field with the fieldIndex passed in, read from the persistent storage was NULL, false otherwise.
		/// Should not be used for testing if the current value is NULL, use <see cref="TestCurrentFieldValueForNull"/> for that.</summary>
		/// <param name="fieldIndex">Index of the field to test if that field was NULL in the persistent storage</param>
		/// <returns>true if the field with the passed in index was NULL in the persistent storage, false otherwise</returns>
		public bool TestOriginalFieldValueForNull(ActionFieldIndex fieldIndex)
		{
			return base.Fields[(int)fieldIndex].IsNull;
		}
		
		/// <summary>Returns true if the current value for the field with the fieldIndex passed in represents null/not defined, false otherwise.
		/// Should not be used for testing if the original value (read from the db) is NULL</summary>
		/// <param name="fieldIndex">Index of the field to test if its currentvalue is null/undefined</param>
		/// <returns>true if the field's value isn't defined yet, false otherwise</returns>
		public bool TestCurrentFieldValueForNull(ActionFieldIndex fieldIndex)
		{
			return base.CheckIfCurrentFieldValueIsNull((int)fieldIndex);
		}

				
		/// <summary>Gets a list of all the EntityRelation objects the type of this instance has.</summary>
		/// <returns>A list of all the EntityRelation objects the type of this instance has. Hierarchy relations are excluded.</returns>
		public override List<IEntityRelation> GetAllRelations()
		{
			return new ActionRelations().GetAllRelations();
		}


		/// <summary> Retrieves all related entities of type 'ActionGridColumnEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <returns>Filled collection with all related entities of type 'ActionGridColumnEntity'</returns>
		public CARMSData.CollectionClasses.ActionGridColumnCollection GetMultiActionGridColumn(bool forceFetch)
		{
			return GetMultiActionGridColumn(forceFetch, _actionGridColumn.EntityFactoryToUse, null);
		}

		/// <summary> Retrieves all related entities of type 'ActionGridColumnEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="filter">Extra filter to limit the resultset.</param>
		/// <returns>Filled collection with all related entities of type 'ActionGridColumnEntity'</returns>
		public CARMSData.CollectionClasses.ActionGridColumnCollection GetMultiActionGridColumn(bool forceFetch, IPredicateExpression filter)
		{
			return GetMultiActionGridColumn(forceFetch, _actionGridColumn.EntityFactoryToUse, filter);
		}

		/// <summary> Retrieves all related entities of type 'ActionGridColumnEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="entityFactoryToUse">The entity factory to use for the GetMultiManyToOne() routine.</param>
		/// <returns>Filled collection with all related entities of the type constructed by the passed in entity factory</returns>
		public CARMSData.CollectionClasses.ActionGridColumnCollection GetMultiActionGridColumn(bool forceFetch, IEntityFactory entityFactoryToUse)
		{
			return GetMultiActionGridColumn(forceFetch, entityFactoryToUse, null);
		}

		/// <summary> Retrieves all related entities of type 'ActionGridColumnEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="entityFactoryToUse">The entity factory to use for the GetMultiManyToOne() routine.</param>
		/// <param name="filter">Extra filter to limit the resultset.</param>
		/// <returns>Filled collection with all related entities of the type constructed by the passed in entity factory</returns>
		public virtual CARMSData.CollectionClasses.ActionGridColumnCollection GetMultiActionGridColumn(bool forceFetch, IEntityFactory entityFactoryToUse, IPredicateExpression filter)
		{
 			if( ( !_alreadyFetchedActionGridColumn || forceFetch || _alwaysFetchActionGridColumn) && !base.IsSerializing && !base.IsDeserializing && !base.InDesignMode)
			{
				if(base.ParticipatesInTransaction)
				{
					if(!_actionGridColumn.ParticipatesInTransaction)
					{
						base.Transaction.Add(_actionGridColumn);
					}
				}
				_actionGridColumn.SuppressClearInGetMulti=!forceFetch;
				if(entityFactoryToUse!=null)
				{
					_actionGridColumn.EntityFactoryToUse = entityFactoryToUse;
				}
				_actionGridColumn.GetMultiManyToOne(this, filter);
				_actionGridColumn.SuppressClearInGetMulti=false;
				_alreadyFetchedActionGridColumn = true;
			}
			return _actionGridColumn;
		}

		/// <summary> Sets the collection parameters for the collection for 'ActionGridColumn'. These settings will be taken into account
		/// when the property ActionGridColumn is requested or GetMultiActionGridColumn is called.</summary>
		/// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return. When set to 0, this parameter is ignored</param>
		/// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified (null), no sorting is applied.</param>
		public virtual void SetCollectionParametersActionGridColumn(long maxNumberOfItemsToReturn, ISortExpression sortClauses)
		{
			_actionGridColumn.SortClauses=sortClauses;
			_actionGridColumn.MaxNumberOfItemsToReturn=maxNumberOfItemsToReturn;
		}

		/// <summary> Retrieves all related entities of type 'RoleActionEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <returns>Filled collection with all related entities of type 'RoleActionEntity'</returns>
		public CARMSData.CollectionClasses.RoleActionCollection GetMultiRoleAction(bool forceFetch)
		{
			return GetMultiRoleAction(forceFetch, _roleAction.EntityFactoryToUse, null);
		}

		/// <summary> Retrieves all related entities of type 'RoleActionEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="filter">Extra filter to limit the resultset.</param>
		/// <returns>Filled collection with all related entities of type 'RoleActionEntity'</returns>
		public CARMSData.CollectionClasses.RoleActionCollection GetMultiRoleAction(bool forceFetch, IPredicateExpression filter)
		{
			return GetMultiRoleAction(forceFetch, _roleAction.EntityFactoryToUse, filter);
		}

		/// <summary> Retrieves all related entities of type 'RoleActionEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="entityFactoryToUse">The entity factory to use for the GetMultiManyToOne() routine.</param>
		/// <returns>Filled collection with all related entities of the type constructed by the passed in entity factory</returns>
		public CARMSData.CollectionClasses.RoleActionCollection GetMultiRoleAction(bool forceFetch, IEntityFactory entityFactoryToUse)
		{
			return GetMultiRoleAction(forceFetch, entityFactoryToUse, null);
		}

		/// <summary> Retrieves all related entities of type 'RoleActionEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="entityFactoryToUse">The entity factory to use for the GetMultiManyToOne() routine.</param>
		/// <param name="filter">Extra filter to limit the resultset.</param>
		/// <returns>Filled collection with all related entities of the type constructed by the passed in entity factory</returns>
		public virtual CARMSData.CollectionClasses.RoleActionCollection GetMultiRoleAction(bool forceFetch, IEntityFactory entityFactoryToUse, IPredicateExpression filter)
		{
 			if( ( !_alreadyFetchedRoleAction || forceFetch || _alwaysFetchRoleAction) && !base.IsSerializing && !base.IsDeserializing && !base.InDesignMode)
			{
				if(base.ParticipatesInTransaction)
				{
					if(!_roleAction.ParticipatesInTransaction)
					{
						base.Transaction.Add(_roleAction);
					}
				}
				_roleAction.SuppressClearInGetMulti=!forceFetch;
				if(entityFactoryToUse!=null)
				{
					_roleAction.EntityFactoryToUse = entityFactoryToUse;
				}
				_roleAction.GetMultiManyToOne(this, null, filter);
				_roleAction.SuppressClearInGetMulti=false;
				_alreadyFetchedRoleAction = true;
			}
			return _roleAction;
		}

		/// <summary> Sets the collection parameters for the collection for 'RoleAction'. These settings will be taken into account
		/// when the property RoleAction is requested or GetMultiRoleAction is called.</summary>
		/// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return. When set to 0, this parameter is ignored</param>
		/// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified (null), no sorting is applied.</param>
		public virtual void SetCollectionParametersRoleAction(long maxNumberOfItemsToReturn, ISortExpression sortClauses)
		{
			_roleAction.SortClauses=sortClauses;
			_roleAction.MaxNumberOfItemsToReturn=maxNumberOfItemsToReturn;
		}

		/// <summary> Retrieves all related entities of type 'TemplateEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <returns>Filled collection with all related entities of type 'TemplateEntity'</returns>
		public CARMSData.CollectionClasses.TemplateCollection GetMultiTemplate(bool forceFetch)
		{
			return GetMultiTemplate(forceFetch, _template.EntityFactoryToUse, null);
		}

		/// <summary> Retrieves all related entities of type 'TemplateEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="filter">Extra filter to limit the resultset.</param>
		/// <returns>Filled collection with all related entities of type 'TemplateEntity'</returns>
		public CARMSData.CollectionClasses.TemplateCollection GetMultiTemplate(bool forceFetch, IPredicateExpression filter)
		{
			return GetMultiTemplate(forceFetch, _template.EntityFactoryToUse, filter);
		}

		/// <summary> Retrieves all related entities of type 'TemplateEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="entityFactoryToUse">The entity factory to use for the GetMultiManyToOne() routine.</param>
		/// <returns>Filled collection with all related entities of the type constructed by the passed in entity factory</returns>
		public CARMSData.CollectionClasses.TemplateCollection GetMultiTemplate(bool forceFetch, IEntityFactory entityFactoryToUse)
		{
			return GetMultiTemplate(forceFetch, entityFactoryToUse, null);
		}

		/// <summary> Retrieves all related entities of type 'TemplateEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="entityFactoryToUse">The entity factory to use for the GetMultiManyToOne() routine.</param>
		/// <param name="filter">Extra filter to limit the resultset.</param>
		/// <returns>Filled collection with all related entities of the type constructed by the passed in entity factory</returns>
		public virtual CARMSData.CollectionClasses.TemplateCollection GetMultiTemplate(bool forceFetch, IEntityFactory entityFactoryToUse, IPredicateExpression filter)
		{
 			if( ( !_alreadyFetchedTemplate || forceFetch || _alwaysFetchTemplate) && !base.IsSerializing && !base.IsDeserializing && !base.InDesignMode)
			{
				if(base.ParticipatesInTransaction)
				{
					if(!_template.ParticipatesInTransaction)
					{
						base.Transaction.Add(_template);
					}
				}
				_template.SuppressClearInGetMulti=!forceFetch;
				if(entityFactoryToUse!=null)
				{
					_template.EntityFactoryToUse = entityFactoryToUse;
				}
				_template.GetMultiManyToOne(this, filter);
				_template.SuppressClearInGetMulti=false;
				_alreadyFetchedTemplate = true;
			}
			return _template;
		}

		/// <summary> Sets the collection parameters for the collection for 'Template'. These settings will be taken into account
		/// when the property Template is requested or GetMultiTemplate is called.</summary>
		/// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return. When set to 0, this parameter is ignored</param>
		/// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified (null), no sorting is applied.</param>
		public virtual void SetCollectionParametersTemplate(long maxNumberOfItemsToReturn, ISortExpression sortClauses)
		{
			_template.SortClauses=sortClauses;
			_template.MaxNumberOfItemsToReturn=maxNumberOfItemsToReturn;
		}

		/// <summary> Retrieves all related entities of type 'UserActionEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <returns>Filled collection with all related entities of type 'UserActionEntity'</returns>
		public CARMSData.CollectionClasses.UserActionCollection GetMultiUserAction(bool forceFetch)
		{
			return GetMultiUserAction(forceFetch, _userAction.EntityFactoryToUse, null);
		}

		/// <summary> Retrieves all related entities of type 'UserActionEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="filter">Extra filter to limit the resultset.</param>
		/// <returns>Filled collection with all related entities of type 'UserActionEntity'</returns>
		public CARMSData.CollectionClasses.UserActionCollection GetMultiUserAction(bool forceFetch, IPredicateExpression filter)
		{
			return GetMultiUserAction(forceFetch, _userAction.EntityFactoryToUse, filter);
		}

		/// <summary> Retrieves all related entities of type 'UserActionEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="entityFactoryToUse">The entity factory to use for the GetMultiManyToOne() routine.</param>
		/// <returns>Filled collection with all related entities of the type constructed by the passed in entity factory</returns>
		public CARMSData.CollectionClasses.UserActionCollection GetMultiUserAction(bool forceFetch, IEntityFactory entityFactoryToUse)
		{
			return GetMultiUserAction(forceFetch, entityFactoryToUse, null);
		}

		/// <summary> Retrieves all related entities of type 'UserActionEntity' using a relation of type '1:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="entityFactoryToUse">The entity factory to use for the GetMultiManyToOne() routine.</param>
		/// <param name="filter">Extra filter to limit the resultset.</param>
		/// <returns>Filled collection with all related entities of the type constructed by the passed in entity factory</returns>
		public virtual CARMSData.CollectionClasses.UserActionCollection GetMultiUserAction(bool forceFetch, IEntityFactory entityFactoryToUse, IPredicateExpression filter)
		{
 			if( ( !_alreadyFetchedUserAction || forceFetch || _alwaysFetchUserAction) && !base.IsSerializing && !base.IsDeserializing && !base.InDesignMode)
			{
				if(base.ParticipatesInTransaction)
				{
					if(!_userAction.ParticipatesInTransaction)
					{
						base.Transaction.Add(_userAction);
					}
				}
				_userAction.SuppressClearInGetMulti=!forceFetch;
				if(entityFactoryToUse!=null)
				{
					_userAction.EntityFactoryToUse = entityFactoryToUse;
				}
				_userAction.GetMultiManyToOne(this, null, filter);
				_userAction.SuppressClearInGetMulti=false;
				_alreadyFetchedUserAction = true;
			}
			return _userAction;
		}

		/// <summary> Sets the collection parameters for the collection for 'UserAction'. These settings will be taken into account
		/// when the property UserAction is requested or GetMultiUserAction is called.</summary>
		/// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return. When set to 0, this parameter is ignored</param>
		/// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified (null), no sorting is applied.</param>
		public virtual void SetCollectionParametersUserAction(long maxNumberOfItemsToReturn, ISortExpression sortClauses)
		{
			_userAction.SortClauses=sortClauses;
			_userAction.MaxNumberOfItemsToReturn=maxNumberOfItemsToReturn;
		}

		/// <summary> Retrieves all related entities of type 'RoleEntity' using a relation of type 'm:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <returns>Filled collection with all related entities of type 'RoleEntity'</returns>
		public CARMSData.CollectionClasses.RoleCollection GetMultiRoleCollectionViaRoleAction(bool forceFetch)
		{
			return GetMultiRoleCollectionViaRoleAction(forceFetch, _roleCollectionViaRoleAction.EntityFactoryToUse);
		}

		/// <summary> Retrieves all related entities of type 'RoleEntity' using a relation of type 'm:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="entityFactoryToUse">The entity factory to use for the GetMultiManyToMany() routine.</param>
		/// <returns>Filled collection with all related entities of the type constructed by the passed in entity factory</returns>
		public CARMSData.CollectionClasses.RoleCollection GetMultiRoleCollectionViaRoleAction(bool forceFetch, IEntityFactory entityFactoryToUse)
		{
 			if( ( !_alreadyFetchedRoleCollectionViaRoleAction || forceFetch || _alwaysFetchRoleCollectionViaRoleAction) && !base.IsSerializing && !base.IsDeserializing && !base.InDesignMode)
			{
				if(base.ParticipatesInTransaction)
				{
					if(!_roleCollectionViaRoleAction.ParticipatesInTransaction)
					{
						base.Transaction.Add(_roleCollectionViaRoleAction);
					}
				}
				IPredicateExpression filter = new PredicateExpression();
				filter.Add(new FieldCompareValuePredicate(ActionFields.ActionId, ComparisonOperator.Equal, this.ActionId, "ActionEntity__"));
				_roleCollectionViaRoleAction.SuppressClearInGetMulti=!forceFetch;
				if(entityFactoryToUse!=null)
				{
					_roleCollectionViaRoleAction.EntityFactoryToUse = entityFactoryToUse;
				}
				_roleCollectionViaRoleAction.GetMulti(filter, GetRelationsForField("RoleCollectionViaRoleAction"));
				_roleCollectionViaRoleAction.SuppressClearInGetMulti=false;
				_alreadyFetchedRoleCollectionViaRoleAction = true;
			}
			return _roleCollectionViaRoleAction;
		}

		/// <summary> Sets the collection parameters for the collection for 'RoleCollectionViaRoleAction'. These settings will be taken into account
		/// when the property RoleCollectionViaRoleAction is requested or GetMultiRoleCollectionViaRoleAction is called.</summary>
		/// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return. When set to 0, this parameter is ignored</param>
		/// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified (null), no sorting is applied.</param>
		public virtual void SetCollectionParametersRoleCollectionViaRoleAction(long maxNumberOfItemsToReturn, ISortExpression sortClauses)
		{
			_roleCollectionViaRoleAction.SortClauses=sortClauses;
			_roleCollectionViaRoleAction.MaxNumberOfItemsToReturn=maxNumberOfItemsToReturn;
		}

		/// <summary> Retrieves all related entities of type 'UserEntity' using a relation of type 'm:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <returns>Filled collection with all related entities of type 'UserEntity'</returns>
		public CARMSData.CollectionClasses.UserCollection GetMultiUserCollectionViaUserAction(bool forceFetch)
		{
			return GetMultiUserCollectionViaUserAction(forceFetch, _userCollectionViaUserAction.EntityFactoryToUse);
		}

		/// <summary> Retrieves all related entities of type 'UserEntity' using a relation of type 'm:n'.</summary>
		/// <param name="forceFetch">if true, it will discard any changes currently in the collection and will rerun the complete query instead</param>
		/// <param name="entityFactoryToUse">The entity factory to use for the GetMultiManyToMany() routine.</param>
		/// <returns>Filled collection with all related entities of the type constructed by the passed in entity factory</returns>
		public CARMSData.CollectionClasses.UserCollection GetMultiUserCollectionViaUserAction(bool forceFetch, IEntityFactory entityFactoryToUse)
		{
 			if( ( !_alreadyFetchedUserCollectionViaUserAction || forceFetch || _alwaysFetchUserCollectionViaUserAction) && !base.IsSerializing && !base.IsDeserializing && !base.InDesignMode)
			{
				if(base.ParticipatesInTransaction)
				{
					if(!_userCollectionViaUserAction.ParticipatesInTransaction)
					{
						base.Transaction.Add(_userCollectionViaUserAction);
					}
				}
				IPredicateExpression filter = new PredicateExpression();
				filter.Add(new FieldCompareValuePredicate(ActionFields.ActionId, ComparisonOperator.Equal, this.ActionId, "ActionEntity__"));
				_userCollectionViaUserAction.SuppressClearInGetMulti=!forceFetch;
				if(entityFactoryToUse!=null)
				{
					_userCollectionViaUserAction.EntityFactoryToUse = entityFactoryToUse;
				}
				_userCollectionViaUserAction.GetMulti(filter, GetRelationsForField("UserCollectionViaUserAction"));
				_userCollectionViaUserAction.SuppressClearInGetMulti=false;
				_alreadyFetchedUserCollectionViaUserAction = true;
			}
			return _userCollectionViaUserAction;
		}

		/// <summary> Sets the collection parameters for the collection for 'UserCollectionViaUserAction'. These settings will be taken into account
		/// when the property UserCollectionViaUserAction is requested or GetMultiUserCollectionViaUserAction is called.</summary>
		/// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return. When set to 0, this parameter is ignored</param>
		/// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified (null), no sorting is applied.</param>
		public virtual void SetCollectionParametersUserCollectionViaUserAction(long maxNumberOfItemsToReturn, ISortExpression sortClauses)
		{
			_userCollectionViaUserAction.SortClauses=sortClauses;
			_userCollectionViaUserAction.MaxNumberOfItemsToReturn=maxNumberOfItemsToReturn;
		}



		/// <summary> Performs the insert action of a new Entity to the persistent storage.</summary>
		/// <returns>true if succeeded, false otherwise</returns>
		protected override bool InsertEntity()
		{
			ActionDAO dao = (ActionDAO)CreateDAOInstance();
			return dao.AddNew(base.Fields, base.Transaction);
		}
		
		/// <summary> Adds the internals to the active context. </summary>
		protected override void AddInternalsToContext()
		{
			_actionGridColumn.ActiveContext = base.ActiveContext;
			_roleAction.ActiveContext = base.ActiveContext;
			_template.ActiveContext = base.ActiveContext;
			_userAction.ActiveContext = base.ActiveContext;
			_roleCollectionViaRoleAction.ActiveContext = base.ActiveContext;
			_userCollectionViaUserAction.ActiveContext = base.ActiveContext;



		}


		/// <summary> Performs the update action of an existing Entity to the persistent storage.</summary>
		/// <returns>true if succeeded, false otherwise</returns>
		protected override bool UpdateEntity()
		{
			ActionDAO dao = (ActionDAO)CreateDAOInstance();
			return dao.UpdateExisting(base.Fields, base.Transaction);
		}
		
		/// <summary> Performs the update action of an existing Entity to the persistent storage.</summary>
		/// <param name="updateRestriction">Predicate expression, meant for concurrency checks in an Update query</param>
		/// <returns>true if succeeded, false otherwise</returns>
		protected override bool UpdateEntity(IPredicate updateRestriction)
		{
			ActionDAO dao = (ActionDAO)CreateDAOInstance();
			return dao.UpdateExisting(base.Fields, base.Transaction, updateRestriction);
		}
	
		/// <summary> Initializes the class with empty data, as if it is a new Entity.</summary>
		/// <param name="validatorToUse">Validator to use.</param>
		protected virtual void InitClassEmpty(IValidator validatorToUse)
		{
			OnInitializing();
			base.Fields = CreateFields();
			base.IsNew=true;
			base.Validator = validatorToUse;

			InitClassMembers();
			
			// __LLBLGENPRO_USER_CODE_REGION_START InitClassEmpty
			// __LLBLGENPRO_USER_CODE_REGION_END

			OnInitialized();
		}
		
		/// <summary>Creates entity fields object for this entity. Used in constructor to setup this entity in a polymorphic scenario.</summary>
		protected virtual IEntityFields CreateFields()
		{
			return EntityFieldsFactory.CreateEntityFieldsObject(CARMSData.EntityType.ActionEntity);
		}
		
		/// <summary>Creates a new transaction object</summary>
		/// <param name="levelOfIsolation">The level of isolation.</param>
		/// <param name="name">The name.</param>
		protected override ITransaction CreateTransaction( IsolationLevel levelOfIsolation, string name )
		{
			return new Transaction(levelOfIsolation, name);
		}

		/// <summary>
		/// Creates the ITypeDefaultValue instance used to provide default values for value types which aren't of type nullable(of T)
		/// </summary>
		/// <returns></returns>
		protected override ITypeDefaultValue CreateTypeDefaultValueProvider()
		{
			return new TypeDefaultValue();
		}

		/// <summary>
		/// Gets all related data objects, stored by name. The name is the field name mapped onto the relation for that particular data element. 
		/// </summary>
		/// <returns>Dictionary with per name the related referenced data element, which can be an entity collection or an entity or null</returns>
		public override Dictionary<string, object> GetRelatedData()
		{
			Dictionary<string, object> toReturn = new Dictionary<string, object>();

			toReturn.Add("ActionGridColumn", _actionGridColumn);
			toReturn.Add("RoleAction", _roleAction);
			toReturn.Add("Template", _template);
			toReturn.Add("UserAction", _userAction);
			toReturn.Add("RoleCollectionViaRoleAction", _roleCollectionViaRoleAction);
			toReturn.Add("UserCollectionViaUserAction", _userCollectionViaUserAction);

			return toReturn;
		}
		

		/// <summary> Initializes the the entity and fetches the data related to the entity in this entity.</summary>
		/// <param name="actionId">PK value for Action which data should be fetched into this Action object</param>
		/// <param name="validator">The validator object for this ActionEntity</param>
		/// <param name="prefetchPathToUse">the PrefetchPath which defines the graph of objects to fetch as well</param>
		protected virtual void InitClassFetch(System.String actionId, IValidator validator, IPrefetchPath prefetchPathToUse)
		{
			OnInitializing();
			base.Validator = validator;
			InitClassMembers();
			base.Fields = CreateFields();
			bool wasSuccesful = Fetch(actionId, prefetchPathToUse, null, null);
			base.IsNew = !wasSuccesful;

			
			// __LLBLGENPRO_USER_CODE_REGION_START InitClassFetch
			// __LLBLGENPRO_USER_CODE_REGION_END

			OnInitialized();
		}

		/// <summary> Initializes the class members</summary>
		private void InitClassMembers()
		{
			_actionGridColumn = new CARMSData.CollectionClasses.ActionGridColumnCollection(new ActionGridColumnEntityFactory());
			_actionGridColumn.SetContainingEntityInfo(this, "Action");
			_alwaysFetchActionGridColumn = false;
			_alreadyFetchedActionGridColumn = false;
			_roleAction = new CARMSData.CollectionClasses.RoleActionCollection(new RoleActionEntityFactory());
			_roleAction.SetContainingEntityInfo(this, "Action");
			_alwaysFetchRoleAction = false;
			_alreadyFetchedRoleAction = false;
			_template = new CARMSData.CollectionClasses.TemplateCollection(new TemplateEntityFactory());
			_template.SetContainingEntityInfo(this, "Action");
			_alwaysFetchTemplate = false;
			_alreadyFetchedTemplate = false;
			_userAction = new CARMSData.CollectionClasses.UserActionCollection(new UserActionEntityFactory());
			_userAction.SetContainingEntityInfo(this, "Action");
			_alwaysFetchUserAction = false;
			_alreadyFetchedUserAction = false;
			_roleCollectionViaRoleAction = new CARMSData.CollectionClasses.RoleCollection(new RoleEntityFactory());
			_alwaysFetchRoleCollectionViaRoleAction = false;
			_alreadyFetchedRoleCollectionViaRoleAction = false;
			_userCollectionViaUserAction = new CARMSData.CollectionClasses.UserCollection(new UserEntityFactory());
			_alwaysFetchUserCollectionViaUserAction = false;
			_alreadyFetchedUserCollectionViaUserAction = false;



			PerformDependencyInjection();
			
			// __LLBLGENPRO_USER_CODE_REGION_START InitClassMembers
			// __LLBLGENPRO_USER_CODE_REGION_END
			OnInitClassMembersComplete();
		}

		#region Custom Property Hashtable Setup
		/// <summary> Initializes the hashtables for the entity type and entity field custom properties. </summary>
		private static void SetupCustomPropertyHashtables()
		{
			_customProperties = new Dictionary<string, string>();
			_fieldsCustomProperties = new Dictionary<string, Dictionary<string, string>>();

			Dictionary<string, string> fieldHashtable = null;
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("ActionId", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("ActionName", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("ParentId", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("NavigateUrl", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("IsActive", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("ImageUrl", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("SortIndex", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("CreateDate", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("Description", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("IsShowEventButton", fieldHashtable);
			fieldHashtable = new Dictionary<string, string>();

			_fieldsCustomProperties.Add("DbtableName", fieldHashtable);
		}
		#endregion




		/// <summary> Fetches the entity from the persistent storage. Fetch simply reads the entity into an EntityFields object. </summary>
		/// <param name="actionId">PK value for Action which data should be fetched into this Action object</param>
		/// <param name="prefetchPathToUse">the PrefetchPath which defines the graph of objects to fetch as well</param>
		/// <param name="contextToUse">The context to add the entity to if the fetch was succesful. </param>
		/// <param name="excludedIncludedFields">The list of IEntityField objects which have to be excluded or included for the fetch. 
		/// If null or empty, all fields are fetched (default). If an instance of ExcludeIncludeFieldsList is passed in and its ExcludeContainedFields property
		/// is set to false, the fields contained in excludedIncludedFields are kept in the query, the rest of the fields in the query are excluded.</param>
		/// <returns>True if succeeded, false otherwise.</returns>
		private bool Fetch(System.String actionId, IPrefetchPath prefetchPathToUse, Context contextToUse, ExcludeIncludeFieldsList excludedIncludedFields)
		{
			try
			{
				OnFetch();
				IDao dao = this.CreateDAOInstance();
				base.Fields[(int)ActionFieldIndex.ActionId].ForcedCurrentValueWrite(actionId);
				dao.FetchExisting(this, base.Transaction, prefetchPathToUse, contextToUse, excludedIncludedFields);
				return (base.Fields.State == EntityState.Fetched);
			}
			finally
			{
				OnFetchComplete();
			}
		}


		/// <summary> Creates the DAO instance for this type</summary>
		/// <returns></returns>
		protected override IDao CreateDAOInstance()
		{
			return DAOFactory.CreateActionDAO();
		}
		
		/// <summary> Creates the entity factory for this type.</summary>
		/// <returns></returns>
		protected override IEntityFactory CreateEntityFactory()
		{
			return new ActionEntityFactory();
		}

		#region Class Property Declarations
		/// <summary> The relations object holding all relations of this entity with other entity classes.</summary>
		public  static ActionRelations Relations
		{
			get	{ return new ActionRelations(); }
		}
		
		/// <summary> The custom properties for this entity type.</summary>
		/// <remarks>The data returned from this property should be considered read-only: it is not thread safe to alter this data at runtime.</remarks>
		public  static Dictionary<string, string> CustomProperties
		{
			get { return _customProperties;}
		}


		/// <summary> Creates a new PrefetchPathElement object which contains all the information to prefetch the related entities of type 'ActionGridColumn' 
		/// for this entity. Add the object returned by this property to an existing PrefetchPath instance.</summary>
		/// <returns>Ready to use IPrefetchPathElement implementation.</returns>
		public static IPrefetchPathElement PrefetchPathActionGridColumn
		{
			get
			{
				return new PrefetchPathElement(new CARMSData.CollectionClasses.ActionGridColumnCollection(),
					(IEntityRelation)GetRelationsForField("ActionGridColumn")[0], (int)CARMSData.EntityType.ActionEntity, (int)CARMSData.EntityType.ActionGridColumnEntity, 0, null, null, null, "ActionGridColumn", SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany);
			}
		}

		/// <summary> Creates a new PrefetchPathElement object which contains all the information to prefetch the related entities of type 'RoleAction' 
		/// for this entity. Add the object returned by this property to an existing PrefetchPath instance.</summary>
		/// <returns>Ready to use IPrefetchPathElement implementation.</returns>
		public static IPrefetchPathElement PrefetchPathRoleAction
		{
			get
			{
				return new PrefetchPathElement(new CARMSData.CollectionClasses.RoleActionCollection(),
					(IEntityRelation)GetRelationsForField("RoleAction")[0], (int)CARMSData.EntityType.ActionEntity, (int)CARMSData.EntityType.RoleActionEntity, 0, null, null, null, "RoleAction", SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany);
			}
		}

		/// <summary> Creates a new PrefetchPathElement object which contains all the information to prefetch the related entities of type 'Template' 
		/// for this entity. Add the object returned by this property to an existing PrefetchPath instance.</summary>
		/// <returns>Ready to use IPrefetchPathElement implementation.</returns>
		public static IPrefetchPathElement PrefetchPathTemplate
		{
			get
			{
				return new PrefetchPathElement(new CARMSData.CollectionClasses.TemplateCollection(),
					(IEntityRelation)GetRelationsForField("Template")[0], (int)CARMSData.EntityType.ActionEntity, (int)CARMSData.EntityType.TemplateEntity, 0, null, null, null, "Template", SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany);
			}
		}

		/// <summary> Creates a new PrefetchPathElement object which contains all the information to prefetch the related entities of type 'UserAction' 
		/// for this entity. Add the object returned by this property to an existing PrefetchPath instance.</summary>
		/// <returns>Ready to use IPrefetchPathElement implementation.</returns>
		public static IPrefetchPathElement PrefetchPathUserAction
		{
			get
			{
				return new PrefetchPathElement(new CARMSData.CollectionClasses.UserActionCollection(),
					(IEntityRelation)GetRelationsForField("UserAction")[0], (int)CARMSData.EntityType.ActionEntity, (int)CARMSData.EntityType.UserActionEntity, 0, null, null, null, "UserAction", SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany);
			}
		}

		/// <summary> Creates a new PrefetchPathElement object which contains all the information to prefetch the related entities of type 'Role' 
		/// for this entity. Add the object returned by this property to an existing PrefetchPath instance.</summary>
		/// <returns>Ready to use IPrefetchPathElement implementation.</returns>
		public static IPrefetchPathElement PrefetchPathRoleCollectionViaRoleAction
		{
			get
			{
				IEntityRelation intermediateRelation = ActionEntity.Relations.RoleActionEntityUsingActionId;
				intermediateRelation.SetAliases(string.Empty, "RoleAction_");
				return new PrefetchPathElement(new CARMSData.CollectionClasses.RoleCollection(), intermediateRelation,
					(int)CARMSData.EntityType.ActionEntity, (int)CARMSData.EntityType.RoleEntity, 0, null, null, GetRelationsForField("RoleCollectionViaRoleAction"), "RoleCollectionViaRoleAction", SD.LLBLGen.Pro.ORMSupportClasses.RelationType.ManyToMany);
			}
		}

		/// <summary> Creates a new PrefetchPathElement object which contains all the information to prefetch the related entities of type 'User' 
		/// for this entity. Add the object returned by this property to an existing PrefetchPath instance.</summary>
		/// <returns>Ready to use IPrefetchPathElement implementation.</returns>
		public static IPrefetchPathElement PrefetchPathUserCollectionViaUserAction
		{
			get
			{
				IEntityRelation intermediateRelation = ActionEntity.Relations.UserActionEntityUsingActionId;
				intermediateRelation.SetAliases(string.Empty, "UserAction_");
				return new PrefetchPathElement(new CARMSData.CollectionClasses.UserCollection(), intermediateRelation,
					(int)CARMSData.EntityType.ActionEntity, (int)CARMSData.EntityType.UserEntity, 0, null, null, GetRelationsForField("UserCollectionViaUserAction"), "UserCollectionViaUserAction", SD.LLBLGen.Pro.ORMSupportClasses.RelationType.ManyToMany);
			}
		}



		/// <summary>Returns the full name for this entity, which is important for the DAO to find back persistence info for this entity.</summary>
		[Browsable(false), XmlIgnore]
		public override string LLBLGenProEntityName
		{
			get { return "ActionEntity";}
		}

		/// <summary> The custom properties for the type of this entity instance.</summary>
		/// <remarks>The data returned from this property should be considered read-only: it is not thread safe to alter this data at runtime.</remarks>
		[Browsable(false), XmlIgnore]
		public override Dictionary<string, string> CustomPropertiesOfType
		{
			get { return ActionEntity.CustomProperties;}
		}

		/// <summary> The custom properties for the fields of this entity type. The returned Hashtable contains per fieldname a hashtable of name-value pairs. </summary>
		/// <remarks>The data returned from this property should be considered read-only: it is not thread safe to alter this data at runtime.</remarks>
		public  static Dictionary<string, Dictionary<string, string>> FieldsCustomProperties
		{
			get { return _fieldsCustomProperties;}
		}

		/// <summary> The custom properties for the fields of the type of this entity instance. The returned Hashtable contains per fieldname a hashtable of name-value pairs. </summary>
		/// <remarks>The data returned from this property should be considered read-only: it is not thread safe to alter this data at runtime.</remarks>
		[Browsable(false), XmlIgnore]
		public override Dictionary<string, Dictionary<string, string>> FieldsCustomPropertiesOfType
		{
			get { return ActionEntity.FieldsCustomProperties;}
		}

		/// <summary> The ActionId property of the Entity Action<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "Action"."ActionID"<br/>
		/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 50<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): false, true, false</remarks>
		public virtual System.String ActionId
		{
			get { return (System.String)GetValue((int)ActionFieldIndex.ActionId, true); }
			set	{ SetValue((int)ActionFieldIndex.ActionId, value, true); }
		}
		/// <summary> The ActionName property of the Entity Action<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "Action"."ActionName"<br/>
		/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 50<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): false, false, false</remarks>
		public virtual System.String ActionName
		{
			get { return (System.String)GetValue((int)ActionFieldIndex.ActionName, true); }
			set	{ SetValue((int)ActionFieldIndex.ActionName, value, true); }
		}
		/// <summary> The ParentId property of the Entity Action<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "Action"."ParentID"<br/>
		/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 50<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): false, false, false</remarks>
		public virtual System.String ParentId
		{
			get { return (System.String)GetValue((int)ActionFieldIndex.ParentId, true); }
			set	{ SetValue((int)ActionFieldIndex.ParentId, value, true); }
		}
		/// <summary> The NavigateUrl property of the Entity Action<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "Action"."NavigateUrl"<br/>
		/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 500<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): false, false, false</remarks>
		public virtual System.String NavigateUrl
		{
			get { return (System.String)GetValue((int)ActionFieldIndex.NavigateUrl, true); }
			set	{ SetValue((int)ActionFieldIndex.NavigateUrl, value, true); }
		}
		/// <summary> The IsActive property of the Entity Action<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "Action"."IsActive"<br/>
		/// Table field type characteristics (type, precision, scale, length): Bit, 0, 0, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): false, false, false</remarks>
		public virtual System.Boolean IsActive
		{
			get { return (System.Boolean)GetValue((int)ActionFieldIndex.IsActive, true); }
			set	{ SetValue((int)ActionFieldIndex.IsActive, value, true); }
		}
		/// <summary> The ImageUrl property of the Entity Action<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "Action"."ImageUrl"<br/>
		/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 500<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): false, false, false</remarks>
		public virtual System.String ImageUrl
		{
			get { return (System.String)GetValue((int)ActionFieldIndex.ImageUrl, true); }
			set	{ SetValue((int)ActionFieldIndex.ImageUrl, value, true); }
		}
		/// <summary> The SortIndex property of the Entity Action<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "Action"."SortIndex"<br/>
		/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 50<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): false, false, false</remarks>
		public virtual System.String SortIndex
		{
			get { return (System.String)GetValue((int)ActionFieldIndex.SortIndex, true); }
			set	{ SetValue((int)ActionFieldIndex.SortIndex, value, true); }
		}
		/// <summary> The CreateDate property of the Entity Action<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "Action"."CreateDate"<br/>
		/// Table field type characteristics (type, precision, scale, length): DateTime, 0, 0, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): false, false, false</remarks>
		public virtual System.DateTime CreateDate
		{
			get { return (System.DateTime)GetValue((int)ActionFieldIndex.CreateDate, true); }
			set	{ SetValue((int)ActionFieldIndex.CreateDate, value, true); }
		}
		/// <summary> The Description property of the Entity Action<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "Action"."Description"<br/>
		/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 500<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String Description
		{
			get { return (System.String)GetValue((int)ActionFieldIndex.Description, true); }
			set	{ SetValue((int)ActionFieldIndex.Description, value, true); }
		}
		/// <summary> The IsShowEventButton property of the Entity Action<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "Action"."IsShowEventButton"<br/>
		/// Table field type characteristics (type, precision, scale, length): Bit, 0, 0, 0<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): false, false, false</remarks>
		public virtual System.Boolean IsShowEventButton
		{
			get { return (System.Boolean)GetValue((int)ActionFieldIndex.IsShowEventButton, true); }
			set	{ SetValue((int)ActionFieldIndex.IsShowEventButton, value, true); }
		}
		/// <summary> The DbtableName property of the Entity Action<br/><br/>
		/// </summary>
		/// <remarks>Mapped on  table field: "Action"."DBTableName"<br/>
		/// Table field type characteristics (type, precision, scale, length): NVarChar, 0, 0, 50<br/>
		/// Table field behavior characteristics (is nullable, is PK, is identity): true, false, false</remarks>
		public virtual System.String DbtableName
		{
			get { return (System.String)GetValue((int)ActionFieldIndex.DbtableName, true); }
			set	{ SetValue((int)ActionFieldIndex.DbtableName, value, true); }
		}

		/// <summary> Retrieves all related entities of type 'ActionGridColumnEntity' using a relation of type '1:n'.</summary>
		/// <remarks>This property is added for databinding conveniance, however it is recommeded to use the method 'GetMultiActionGridColumn()', because 
		/// this property is rather expensive and a method tells the user to cache the result when it has to be used more than once in the same scope.</remarks>
		public virtual CARMSData.CollectionClasses.ActionGridColumnCollection ActionGridColumn
		{
			get	{ return GetMultiActionGridColumn(false); }
		}

		/// <summary> Gets / sets the lazy loading flag for ActionGridColumn. When set to true, ActionGridColumn is always refetched from the 
		/// persistent storage. When set to false, the data is only fetched the first time ActionGridColumn is accessed. You can always execute
		/// a forced fetch by calling GetMultiActionGridColumn(true).</summary>
		[Browsable(false)]
		public bool AlwaysFetchActionGridColumn
		{
			get	{ return _alwaysFetchActionGridColumn; }
			set	{ _alwaysFetchActionGridColumn = value; }	
		}		
				
		/// <summary>Gets / Sets the lazy loading flag if the property ActionGridColumn already has been fetched. Setting this property to false when ActionGridColumn has been fetched
		/// will clear the ActionGridColumn collection well. Setting this property to true while ActionGridColumn hasn't been fetched disables lazy loading for ActionGridColumn</summary>
		[Browsable(false)]
		public bool AlreadyFetchedActionGridColumn
		{
			get { return _alreadyFetchedActionGridColumn;}
			set 
			{
				if(_alreadyFetchedActionGridColumn && !value && (_actionGridColumn != null))
				{
					_actionGridColumn.Clear();
				}
				_alreadyFetchedActionGridColumn = value;
			}
		}
		/// <summary> Retrieves all related entities of type 'RoleActionEntity' using a relation of type '1:n'.</summary>
		/// <remarks>This property is added for databinding conveniance, however it is recommeded to use the method 'GetMultiRoleAction()', because 
		/// this property is rather expensive and a method tells the user to cache the result when it has to be used more than once in the same scope.</remarks>
		public virtual CARMSData.CollectionClasses.RoleActionCollection RoleAction
		{
			get	{ return GetMultiRoleAction(false); }
		}

		/// <summary> Gets / sets the lazy loading flag for RoleAction. When set to true, RoleAction is always refetched from the 
		/// persistent storage. When set to false, the data is only fetched the first time RoleAction is accessed. You can always execute
		/// a forced fetch by calling GetMultiRoleAction(true).</summary>
		[Browsable(false)]
		public bool AlwaysFetchRoleAction
		{
			get	{ return _alwaysFetchRoleAction; }
			set	{ _alwaysFetchRoleAction = value; }	
		}		
				
		/// <summary>Gets / Sets the lazy loading flag if the property RoleAction already has been fetched. Setting this property to false when RoleAction has been fetched
		/// will clear the RoleAction collection well. Setting this property to true while RoleAction hasn't been fetched disables lazy loading for RoleAction</summary>
		[Browsable(false)]
		public bool AlreadyFetchedRoleAction
		{
			get { return _alreadyFetchedRoleAction;}
			set 
			{
				if(_alreadyFetchedRoleAction && !value && (_roleAction != null))
				{
					_roleAction.Clear();
				}
				_alreadyFetchedRoleAction = value;
			}
		}
		/// <summary> Retrieves all related entities of type 'TemplateEntity' using a relation of type '1:n'.</summary>
		/// <remarks>This property is added for databinding conveniance, however it is recommeded to use the method 'GetMultiTemplate()', because 
		/// this property is rather expensive and a method tells the user to cache the result when it has to be used more than once in the same scope.</remarks>
		public virtual CARMSData.CollectionClasses.TemplateCollection Template
		{
			get	{ return GetMultiTemplate(false); }
		}

		/// <summary> Gets / sets the lazy loading flag for Template. When set to true, Template is always refetched from the 
		/// persistent storage. When set to false, the data is only fetched the first time Template is accessed. You can always execute
		/// a forced fetch by calling GetMultiTemplate(true).</summary>
		[Browsable(false)]
		public bool AlwaysFetchTemplate
		{
			get	{ return _alwaysFetchTemplate; }
			set	{ _alwaysFetchTemplate = value; }	
		}		
				
		/// <summary>Gets / Sets the lazy loading flag if the property Template already has been fetched. Setting this property to false when Template has been fetched
		/// will clear the Template collection well. Setting this property to true while Template hasn't been fetched disables lazy loading for Template</summary>
		[Browsable(false)]
		public bool AlreadyFetchedTemplate
		{
			get { return _alreadyFetchedTemplate;}
			set 
			{
				if(_alreadyFetchedTemplate && !value && (_template != null))
				{
					_template.Clear();
				}
				_alreadyFetchedTemplate = value;
			}
		}
		/// <summary> Retrieves all related entities of type 'UserActionEntity' using a relation of type '1:n'.</summary>
		/// <remarks>This property is added for databinding conveniance, however it is recommeded to use the method 'GetMultiUserAction()', because 
		/// this property is rather expensive and a method tells the user to cache the result when it has to be used more than once in the same scope.</remarks>
		public virtual CARMSData.CollectionClasses.UserActionCollection UserAction
		{
			get	{ return GetMultiUserAction(false); }
		}

		/// <summary> Gets / sets the lazy loading flag for UserAction. When set to true, UserAction is always refetched from the 
		/// persistent storage. When set to false, the data is only fetched the first time UserAction is accessed. You can always execute
		/// a forced fetch by calling GetMultiUserAction(true).</summary>
		[Browsable(false)]
		public bool AlwaysFetchUserAction
		{
			get	{ return _alwaysFetchUserAction; }
			set	{ _alwaysFetchUserAction = value; }	
		}		
				
		/// <summary>Gets / Sets the lazy loading flag if the property UserAction already has been fetched. Setting this property to false when UserAction has been fetched
		/// will clear the UserAction collection well. Setting this property to true while UserAction hasn't been fetched disables lazy loading for UserAction</summary>
		[Browsable(false)]
		public bool AlreadyFetchedUserAction
		{
			get { return _alreadyFetchedUserAction;}
			set 
			{
				if(_alreadyFetchedUserAction && !value && (_userAction != null))
				{
					_userAction.Clear();
				}
				_alreadyFetchedUserAction = value;
			}
		}

		/// <summary> Retrieves all related entities of type 'RoleEntity' using a relation of type 'm:n'.</summary>
		/// <remarks>This property is added for databinding conveniance, however it is recommeded to use the method 'GetMultiRoleCollectionViaRoleAction()', because 
		/// this property is rather expensive and a method tells the user to cache the result when it has to be used more than once in the same scope.</remarks>
		public virtual CARMSData.CollectionClasses.RoleCollection RoleCollectionViaRoleAction
		{
			get { return GetMultiRoleCollectionViaRoleAction(false); }
		}

		/// <summary> Gets / sets the lazy loading flag for RoleCollectionViaRoleAction. When set to true, RoleCollectionViaRoleAction is always refetched from the 
		/// persistent storage. When set to false, the data is only fetched the first time RoleCollectionViaRoleAction is accessed. You can always execute
		/// a forced fetch by calling GetMultiRoleCollectionViaRoleAction(true).</summary>
		[Browsable(false)]
		public bool AlwaysFetchRoleCollectionViaRoleAction
		{
			get	{ return _alwaysFetchRoleCollectionViaRoleAction; }
			set	{ _alwaysFetchRoleCollectionViaRoleAction = value; }
		}
				
		/// <summary>Gets / Sets the lazy loading flag if the property RoleCollectionViaRoleAction already has been fetched. Setting this property to false when RoleCollectionViaRoleAction has been fetched
		/// will clear the RoleCollectionViaRoleAction collection well. Setting this property to true while RoleCollectionViaRoleAction hasn't been fetched disables lazy loading for RoleCollectionViaRoleAction</summary>
		[Browsable(false)]
		public bool AlreadyFetchedRoleCollectionViaRoleAction
		{
			get { return _alreadyFetchedRoleCollectionViaRoleAction;}
			set 
			{
				if(_alreadyFetchedRoleCollectionViaRoleAction && !value && (_roleCollectionViaRoleAction != null))
				{
					_roleCollectionViaRoleAction.Clear();
				}
				_alreadyFetchedRoleCollectionViaRoleAction = value;
			}
		}
		/// <summary> Retrieves all related entities of type 'UserEntity' using a relation of type 'm:n'.</summary>
		/// <remarks>This property is added for databinding conveniance, however it is recommeded to use the method 'GetMultiUserCollectionViaUserAction()', because 
		/// this property is rather expensive and a method tells the user to cache the result when it has to be used more than once in the same scope.</remarks>
		public virtual CARMSData.CollectionClasses.UserCollection UserCollectionViaUserAction
		{
			get { return GetMultiUserCollectionViaUserAction(false); }
		}

		/// <summary> Gets / sets the lazy loading flag for UserCollectionViaUserAction. When set to true, UserCollectionViaUserAction is always refetched from the 
		/// persistent storage. When set to false, the data is only fetched the first time UserCollectionViaUserAction is accessed. You can always execute
		/// a forced fetch by calling GetMultiUserCollectionViaUserAction(true).</summary>
		[Browsable(false)]
		public bool AlwaysFetchUserCollectionViaUserAction
		{
			get	{ return _alwaysFetchUserCollectionViaUserAction; }
			set	{ _alwaysFetchUserCollectionViaUserAction = value; }
		}
				
		/// <summary>Gets / Sets the lazy loading flag if the property UserCollectionViaUserAction already has been fetched. Setting this property to false when UserCollectionViaUserAction has been fetched
		/// will clear the UserCollectionViaUserAction collection well. Setting this property to true while UserCollectionViaUserAction hasn't been fetched disables lazy loading for UserCollectionViaUserAction</summary>
		[Browsable(false)]
		public bool AlreadyFetchedUserCollectionViaUserAction
		{
			get { return _alreadyFetchedUserCollectionViaUserAction;}
			set 
			{
				if(_alreadyFetchedUserCollectionViaUserAction && !value && (_userCollectionViaUserAction != null))
				{
					_userCollectionViaUserAction.Clear();
				}
				_alreadyFetchedUserCollectionViaUserAction = value;
			}
		}




		/// <summary> Gets or sets a value indicating whether this entity is a subtype</summary>
		protected override bool LLBLGenProIsSubType
		{
			get { return false;}
		}

		/// <summary> Gets the type of the hierarchy this entity is in. </summary>
		[System.ComponentModel.Browsable(false), XmlIgnore]
		protected override InheritanceHierarchyType LLBLGenProIsInHierarchyOfType
		{
			get { return InheritanceHierarchyType.None;}
		}
		
		/// <summary>Returns the CARMSData.EntityType enum value for this entity.</summary>
		[Browsable(false), XmlIgnore]
		public override int LLBLGenProEntityTypeValue 
		{ 
			get { return (int)CARMSData.EntityType.ActionEntity; }
		}
		#endregion


		#region Custom Entity code
		
		// __LLBLGENPRO_USER_CODE_REGION_START CustomEntityCode
		// __LLBLGENPRO_USER_CODE_REGION_END
		#endregion

		#region Included code

		#endregion
	}
}
